package com.jzd1997.lesson20;

/**
 * @Author: jiangzd
 * @Date: 11:28 2019/7/26
 */
public class LazySingletonSync {
    private static LazySingletonSync logger = null;
    private LazySingletonSync(){
        System.out.println("生成LazyLoggerSync实例一次！");
    }

    public static LazySingletonSync getInstance(){
        if(logger==null){
            synchronized (LazySingletonSync.class){
                if(logger==null){
                    logger = new LazySingletonSync();
                }
            }
        }
        return logger;
    }
}
